package com.iot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author wlr
 * @date 2022/1/5 14:44
 */
@RestController
public class IndexController {
    @Autowired
    DeviceController deviceController;

    @RequestMapping(value = {"/"}, method = RequestMethod.GET)
    public ModelAndView login(ModelAndView modelAndView) {
        modelAndView.setViewName("login");
        return modelAndView;
    }

    @RequestMapping(value = "/registerUI", method = RequestMethod.GET)
    public ModelAndView register(ModelAndView modelAndView) {
        modelAndView.setViewName("register");
        return modelAndView;
    }

    @RequestMapping(value = "/showUI", method = RequestMethod.GET)
    public ModelAndView show(ModelAndView modelAndView) {
        modelAndView.setViewName("show");
        return modelAndView;
    }

    @RequestMapping(value = "/modifypageUI", method = RequestMethod.GET)
    public ModelAndView modifypage(ModelAndView modelAndView) {
        modelAndView.setViewName("modifypage");
        return modelAndView;
    }

    @RequestMapping(value = "/managepageUI", method = RequestMethod.GET)
    public ModelAndView managepage(ModelAndView modelAndView) {
        modelAndView.setViewName("managepage");
        return modelAndView;
    }

    @RequestMapping(value = "/index", method = RequestMethod.GET)
    public ModelAndView index(ModelAndView modelAndView) {
        modelAndView.setViewName("index");
        return modelAndView;
    }

    @RequestMapping(value = "/voiceUI", method = RequestMethod.GET)
    public ModelAndView voiceUI(ModelAndView modelAndView) {
        modelAndView.setViewName("voice");
        return modelAndView;
    }

    @RequestMapping(value = "/lightUI", method = RequestMethod.GET)
    public ModelAndView lightUI(ModelAndView modelAndView) {
        modelAndView.setViewName("light");
        return modelAndView;
    }


    @RequestMapping(value = "/addpageUI", method = RequestMethod.GET)
    public ModelAndView addpageUI(ModelAndView modelAndView) {
        modelAndView.setViewName("addpage");
        return modelAndView;
    }

    @RequestMapping(value = "/addpageDetailUI", method = RequestMethod.GET)
    public ModelAndView addpageDetailUI(ModelAndView modelAndView) {
        modelAndView.setViewName("addpageDetail");
        return modelAndView;
    }

    @RequestMapping(value = "/showDetailUI", method = RequestMethod.GET)
    public ModelAndView testUI(ModelAndView modelAndView) {
        modelAndView.setViewName("showDetail");
        return modelAndView;
    }

    @RequestMapping(value = "/managepageDetailUI", method = RequestMethod.GET)
    public ModelAndView managepageDetail(ModelAndView modelAndView) {
//        modelAndView.setViewName("managepageDetail");
        return deviceController.queryDevice(modelAndView);
    }


}
